package com.zerui.manager.app.openplan;

import com.zerui.cola.dto.PageResponse;
import com.zerui.cola.dto.Response;
import com.zerui.manager.app.openplan.executer.*;
import com.zerui.manager.web.OpenPlanService;
import com.zerui.manager.web.cmd.*;
import com.zerui.manager.web.vo.OpenPlanDeviceVO;
import com.zerui.manager.web.vo.OpenPlanVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Author wh
 * @create_time 2023-08-23 11:08
 */
@Service
public class OpenPlanServiceImpl implements OpenPlanService {

	@Resource
	private OpenPlanAddCmdExe openPlanAddCmdExe;
	@Resource
	private OpenPlanUpdateCmdExe openPlanUpdateCmdExe;
	@Resource
	private OpenPlanDeleteCmdExe openPlanDeleteCmdExe;
	@Resource
	private OpenPlanEnableCmdExe openPlanEnableCmdExe;
	@Resource
	private OpenPlanQryCmdExe openPlanQryCmdExe;
	@Resource
	private OpenPlanDeviceAddCmdExe openPlanDeviceAddCmdExe;
	@Resource
	private OpenPlanDeviceDelCmdExe openPlanDeviceDelCmdExe;
	@Resource
	private OpenPlanDeviceQryCmdExe openPlanDeviceQryCmdExe;

	@Override
	public Response add(OpenPlanAddCmd openPlanAddCmd) {
		return openPlanAddCmdExe.execute(openPlanAddCmd);
	}

	@Override
	public Response update(OpenPlanUpdateCmd openPlanUpdateCmd) {
		return openPlanUpdateCmdExe.execute(openPlanUpdateCmd);
	}

	@Override
	public Response deleteById(Long id) {
		return openPlanDeleteCmdExe.execute(id);
	}

	@Override
	public Response enableById(Long id) {
		return openPlanEnableCmdExe.execute(id);
	}

	@Override
	public PageResponse<OpenPlanVO> getPageList(OpenPlanQryCmd openPlanQryCmd) {
		return openPlanQryCmdExe.execute(openPlanQryCmd);
	}

	@Override
	public Response association(OpenPlanDeviceAddCmd openPlanDeviceAddCmd) {
		return openPlanDeviceAddCmdExe.execute(openPlanDeviceAddCmd);
	}

	@Override
	public Response delete(OpenPlanDeviceAddCmd openPlanDeviceAddCmd) {
		return openPlanDeviceDelCmdExe.execute(openPlanDeviceAddCmd);
	}

	@Override
	public PageResponse<OpenPlanDeviceVO> getDevicePageList(OpenPlanDeviceQryCmd openPlanQryCmd) {
		return openPlanDeviceQryCmdExe.execute(openPlanQryCmd);
	}

	@Override
	public void deleteDeviceById(Long deviceId) {
		openPlanDeviceDelCmdExe.executeById(deviceId);
	}
}
